/*
* $Id: io_m430f1611.h,v 1.6 2007/11/27 04:04:13 sunny Exp $
*/

// clock configuration
#define CPU_CLOCK	4900000L	// 4.9 MHz
//#define	TIMER0_CLOCK	(CPU_CLOCK/2)	// clock source for 1ms timer


// UART port configuration
#define is_CONSOLE_RxFlag()
#define clear_CONSOLE_RxFlag()
#define is_CONSOLE_TxFlag()
#define clear_CONSOLE_TxFlag()

#define CONSOLE_putc(c)			U1TXBUF = c
#define CONSOLE_getc()			U1RXBUF

// UZ2400 port configuration
#define SI				(SI)
#define SO				(SO)
#define SCK				(SCK)
#define RIF				(RIF_0)
#define WIF				(WIF_0)
#define TXBUF				(TXBUF_0)
#define RXBUF				(RXBUF_0)

#define SI_0				(P3OUT_bit.P3OUT_1)
#define SO_0				(P3IN_bit.P3IN_2)
#define SCK_0				(P3OUT_bit.P3OUT_3)
#define RIF_0				(IFG1_bit.URXIFG0)
#define WIF_0				(IFG1_bit.UTXIFG0)

#define enable_uz2400_cs_output()	(P4DIR_bit.P4DIR_2=1)
#define enable_uz2400_reset_output()	(P4DIR_bit.P4DIR_6=1)

#define uz2400_reset_pin		(P4OUT_bit.P4OUT_6)
#define uz2400_int_pin			(P1IN_bit.P1IN_0)
#define uz2400_cs_pin			(P4OUT_bit.P4OUT_2)

#define _UBEC_Activate_SEN()		(uz2400_cs_pin=0)
#define _UBEC_Deactivate_SEN()		(uz2400_cs_pin=1)

#define _UBEC_Activate_RESET()		(uz2400_reset_pin=0)
#define _UBEC_Deactivate_RESET()	(uz2400_reset_pin=1)

// LED port configuration
#define LED1				(P5OUT_bit.P5OUT_4)		// Red
#define LED2				(P5OUT_bit.P5OUT_5)		// Green
#define LED3				(P5OUT_bit.P5OUT_6)		// Yellow
#define enable_LED_output()		(P5DIR |= 0x70)			// P5.4,5,6 = output direction

#define	LINK_LED			LED2				// Green
#define	RXTX_LED			LED1				// Red
#define	SAME_LED_LINK_RXTX		0

#define	POLLING_LED			LED3				// Yellow
#define	UART_LED			LED3
#define	SAME_LED_UART_USER		1
